<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>找回密码</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<script type='text/javascript' src='dwr/interface/userdwr.js'></script>
	<script type='text/javascript' src='<%=basePath %>/dwr/engine.js'></script>
 	<script type='text/javascript' src='<%=basePath %>/dwr/util.js'></script>
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
 <script type='text/javascript' src='js/jquery.validate.min.js'></script>
 <script type='text/javascript' src='js/common.js'></script>
<link href="images/css.css"  rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
.STYLE10 {
	font-size: 14px;
	font-weight: bold;
}
-->
</style>

<script type="text/javascript">

function checkValid(){
	var account=$.trim($("#account").val());    //号码
	var scode=$.trim($("#securityCode").val());  //生成的验证码
		if(account == ""){
			$("#infoErrorSpan").html("");
			$("#infoErrorSpan").html("请输入登录账号.");
			$("#account").focus();
			return false;
		}else{
			//----以下是效验手机号码
			if(!isValidMobile(account)){
				$("#infoErrorSpan").html("&nbsp;&nbsp;输入的登录账号有误.");
				$("#account").select();
				return false;
			}else{
				$("#infoErrorSpan").html("");
			}
			$("#infoErrorSpan").html("");
		}
		
		if(scode == ""){  //效验验证码
			$("#infoErrorSpan").html("");
			$("#infoErrorSpan").html("请输入验证码.");
			$("#securityCode").focus();
			return false;
		}else {
			var vcode = $("#vcode").val(); //后台生成的验证码
		//	var aa= document.getElementById("vcode").value;
		//	alert("aa="+aa);
		//	alert("验证码vcode="+vcode);
			//------------以下是效验验证码的正确性
			 if(isNaN(scode) || scode.length != 4 || scode != vcode){
					$("#infoErrorSpan").html("&nbsp;输入的验证码有误.");
					$("#securityCode").select();
					return false;
			}else{
				$("#infoErrorSpan").html("");
			}
		}

	return true;
}

//DWR - 获取后台生成的验证码
function checkVerCode(){
		//调用java后台UserInfoServiceImpl类方法getSecurityCode()
		userdwr.getSecurityCode(function(data) {
		//	alert("data==="+data);
		//	var verifyCode = $.trim($("#securityCode").val());  //输入框的验证码
			$("#vcode").val(data);//给隐藏域设置值
		//	alert("设置值==="+$("#vcode").val(data));
			document.all.vcode.value =data;
				
		});
}
//表单提交
function zhmmSubmit(){
		if(!checkValid()){
			return false;
		}else{
			$("#zhmm1Frm").submit();
		}
}

/**
 * 判断是不是有效的手机号码
 * 格式正确返回true,否则false.
 */
function isValidMobile(mobile) {
    //var pattern = /^((\(\d{2,3}\))|(\d{3}\-))?13\d{9}$/;
    var pattern = /^((13[0-9]{1}|15[0-9]{1}|18[0-9]{1}|)+\d{8})$/;   
    return pattern.test(mobile);
}

</script>

  </head>
  
  <body onload="checkVerCode();">
  <!--顶部-->
  <s:action name="showTop" executeResult="true"/>

  <form action="userRegister!fwdRetrievedPwd1.action" name ="zhmm1Frm" id="zhmm1Frm" method="post">
    	<table width="796" height="383" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F1F1F1">
  <tr>
    <td width="796" height="26" align="left" valign="top"><span class="STYLE1">&nbsp;首页 &gt;&nbsp;&nbsp;找回密码</span></td>
  </tr>
  <tr>
    <td height="357" align="center" valign="top" bgcolor="#FFFFFF" style="border:1px solid #C5C5C5; padding:1px ;"><table width="100%" height="32" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="1%" height="32" background="images/sp_bg.jpg">&nbsp;</td>
        <td width="3%" align="center" background="images/sp_bg.jpg" style="border-bottom:1px solid #C5C5C5;"><img src="images/dian.jpg" width="10" height="16" /></td>
        <td width="95%" align="left" background="images/sp_bg.jpg" style="border-bottom:1px solid #C5C5C5;"><span class="STYLE3">找回密码</span></td>
        <td width="1%" background="images/sp_bg.jpg">&nbsp;</td>
      </tr>
    </table>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="8">&nbsp;</td>
          </tr>
        </table>
        <table width="656" height="21" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td width="208" height="21" align="center" bgcolor="#F6AD47"><span class="STYLE4">1.填写登录名</span></td>
            <td width="16"><img src="images/H_1.jpg" width="16" height="21" /></td>
            <td width="207" align="center" bgcolor="#DEDEDE" class="STYLE4">2.填写密码查询答案</td>
            <td width="17"><img src="images/H_2.jpg" width="17" height="21" /></td>
            <td width="208" align="center" bgcolor="#DEDEDE" class="STYLE4">3.重置密码</td>
          </tr>
        </table>
      <table width="649" height="224" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td height="41" align="center">&nbsp;</td>
        </tr>
          <tr>
            <td height="66" align="center" class="STYLE5"><table width="649" height="183" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td height="18" align="center">
                <%-- --%>	<span style="color:red"  id="infoErrorSpan"></span>
                	<s:if test="hasErrors()">
						<div class="tip" style="margin-left: 150px;">
							<s:fielderror cssStyle="padding:0;margin:0;"/>
							<s:actionerror cssStyle="padding:0;margin:0;"/>
						</div>
					</s:if>
                	
                </td>
              </tr>
              <tr>
                <td height="119" align="center" class="STYLE5"><table width="324" height="100" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td width="86" height="37" align="right">登录账号： </td>
                      <td width="238" align="left">
                      	<input name="account" id="account" type="text" size="20" maxlength="11" style="border:1px solid #DBDBDB; height:20px;"  />
                          <span class="STYLE6">* </span>
                      </td>
                    </tr>
                    <tr>
                      <td width="86" height="22" align="right">&nbsp;</td>
                      <td width="238" align="left" valign="top"><span style="color: #F38003">登录账户是手机号码</span></td>
                    </tr>

                    <tr>
                      <td  height="34"  align="right">验证码：</td>
                      <td align="left"><table width="199" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td width="53">
                            <input name="securityCode" id="securityCode" size="6" maxlength="4" style="border:1px solid #DBDBDB; height:22px;"/>&nbsp;&nbsp;&nbsp;
                            </td>
                            <td width="55">
	                            <!-- VerifyCodeImg名字是web.xml里面配置的验证码类 -->
	                            <img style="vertical-align: middle;" src="VerifyCodeImg" align="middle" />
                            </td>
                            <td width="92"><%-- 看不清？<a href="#">换一张--%></a>
                            </td>
                          </tr>
                      </table></td>
                    </tr>
                </table></td>
              </tr>
              <tr>
                <td height="46" align="center" class="STYLE5">
                <img src="images/tj1.jpg" onclick="javascript:zhmmSubmit();" style="cursor:hand" width="149" height="24" />
                 <input type="hidden" name="vcode" id="vcode" value="" />
                </td>
              </tr>
            </table></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
 </form>
<table height="80">
	<tr>
		<td>&nbsp;</td>
	</tr>
</table>
 <!--底部-->
<s:action name="showComment" executeResult="true"/>
<%@include file="foot_end.jsp"%>
  </body>
</html>
